package com.fauks.dubbo.controller;

import com.fauks.dubbo.beans.OrderAddress;
import com.fauks.dubbo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
public class OrderController {

    //相当于远程注入
    @Autowired
    private OrderService orderService;

    @GetMapping("test")
    @ResponseBody
    public String test() {
        return "test";
    }

    @GetMapping("/orderAddress")
    @ResponseBody
    public List<OrderAddress> orderList() {
        return orderService.getAddress();
    }

    @GetMapping("orderAddress/{id}")
    @ResponseBody
    public OrderAddress orderById(@PathVariable("id") int id) {
        return orderService.getArressById(id);
    }
}
